﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class EarlyWarning_HosCompanySelect : BasePage
{
    public EarlyWarning_HosCompanySelect()
    { }

    string _AreaId = string.Empty;
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!this.IsPostBack)
        {
            dataBind();
            this.hre2.Visible = false;
            this.gridCompany.Visible = false;
        }
    }

    private void dataBind()
    {
        int t = 0;
        HZ.Supervise.IBLL.IBLL_PreWarning pre = HZ.Supervise.BLLFactory.IBLL_PreWarning();
        System.Data.DataTable dt = new System.Data.DataTable();
        string _values = HZ.Fun.CheckString(this.txtName.Text);

        if (this.dropsort.SelectedItem.Text == "医院")
        {
            this.gridHospital.Visible = true;
            this.hre1.Visible = true;
            this.gridCompany.Visible = false;
            this.hre2.Visible = false;
            dt = pre.GetHospital(_values, _AreaId, AspNetPager1.CurrentPageIndex, AspNetPager1.PageSize, out t);
            AspNetPager1.RecordCount = t;
            this.gridHospital.DataSource = dt;
            this.gridHospital.DataBind();
        }
        else {
            this.gridCompany.Visible = true;
            this.hre2.Visible = true;
            this.gridHospital.Visible = false;
            this.hre1.Visible = false;
            dt = pre.GetCompany(_values, AspNetPager1.CurrentPageIndex, AspNetPager1.PageSize, out t);
            AspNetPager1.RecordCount = t;
            this.gridCompany.DataSource = dt;
            this.gridCompany.DataBind();
        }
    }

    protected void btnEnter_Click(object sender, EventArgs e)
    {
        AspNetPager1.CurrentPageIndex = 1;
        dataBind();
    }
}
